package com.tqjc.business.interactivewithscan.entity;

import com.alibaba.fastjson.JSONObject;
import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @program: C20005_Xianggang_new
 * @description: Scada数据类
 * @author: Patienyon
 * @create: 2023-11-01 19:37
 **/
@Data
public class ScadaCommandEntity {

    private String ip;
    private Integer action;
    private String time;
    private JSONObject data;

    public Integer getAction() {
        return action;
    }

    public String getTime() {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return df.format(new Date());
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }

    public JSONObject getData() {
        if (data == null) {
            data = new JSONObject();
        }
        return data;
    }
}

